Skip to content

perf(birth): place a lifecycle birth on the live engine, no full-world checkpoint (Scaling A13) - #2624

Open
genekogan wants to merge 2 commits into
mainfrom
agent/2621-live-birth-placement
Open

genekogan wants to merge 2 commits into
mainfrom
agent/2621-live-birth-placement

Conversation

@genekogan

@genekogan genekogan commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Problem

When a Soul is born through the lifecycle (the account and Eden capabilities path), a busy world runs probeNativeHumanBirth two or three times per birth: a full snapshot of the world, then a restore that rebuilds the spatial ground. On Eden 2026 with 50 Souls acting, that is about 6 to 7 s of the clock thread per birth. At even one create a second the world goes black and restarts (exit 75), and 0 of 100 creates complete. This PR places the birth on the live engine instead. Closes #2621.

Acceptance

  • A1 An oracle test across many births in Eden 2026 (and a crowded variant): birthPlacementV1 on the live engine agrees with probeNativeHumanBirth's outcome (placement or refusal) on every case. State hashes are equal with the change off and on over the walk goldens and the birth tests. — evidence: proof.json and these results:

    • node --test apps/server/src/birth-placement-eden.test.ts -> pass, 32 births on Eden 2026 compared: {"ready":30,"unavailable":2}. That is 16 plain births while a Soul walks, the arrival rings crowded until a birth is refused, and both hinted forms.
    • node --test packages/engine-mars/src/birth.test.ts -> 10/10 pass. The crowd fills the arrival point on green field (91 ready, 4 refused, 4 hinted), on the legacy commons (13 ready, 4 refused, 4 hinted: the humanBirthIssue refusal) and on the safe commons (83 ready, 4 refused, 4 hinted). Existing, conflicting and deferred births are also covered. On every case the live outcome deep-equals the probe's, the state hash and tick are unchanged, and spawnHuman lands where the placement said.
    • node --test apps/server/src/lifecycle-runner.test.ts -> 24/24 pass. A new test runs lifecycle births with SIM_BIRTH_PROBE=1 (off), unset (on) and =oracle: the events, poses, engine state hash and kernel hash are equal.
    • SIM_BIRTH_PROBE=oracle node --test packages/engine-mars/src/birth.test.ts packages/engine-mars/src/arrival-clearance.test.ts apps/server/src/lifecycle-runner.test.ts -> 35/35 pass, with every placement checked against the probe.
    • Walk goldens: spawnHuman's search is now an extraction with the same statements in the same order, and it has no switch. node tools/test-harness/walk/walk.mjs -> "walk: no place worse than the baseline". The hash-pinned engine tests (hash, commons-kitchen, terrain, water-geometry) pass 47/47, run together with arrival-clearance, commons, connected-shore-engine and commons-arrival.
  • A2 No full-world snapshot or restore on the birth path; the probe runs only under a test or oracle flag. — evidence: on a world with no ground or paged ground (Eden 2026 and every default ground world: NAV_PAGED defaults on), the guard (lifecycle-runner.ts) and the preview (arrival-placement.ts planNativeBirth) call nativeBirthPlacement, which runs the probe only when SIM_BIRTH_PROBE is 1 or oracle. Test "A13: the birth path never snapshots or restores…" -> 0 snapshots and 0 restores by default. Test "four pending births … with no detached probe" -> 0 restores for four lifecycle births, against 8 with SIM_BIRTH_PROBE=1. One exception: a world on whole (non-paged) ground (NAV_PAGED=0) keeps the probe, because there the live search grew the ground window and moved the navigation epoch (review finding on this PR). Test 'A13: on whole (non-paged) ground…' covers it: same navigation and the same later far walk as a twin that never placed a birth. The oracle tests also assert the live placement leaves the epoch and window unmoved.

  • A3 Bars declared before the runs (settled --wave, 100 creates at 1 a second with 50 acting, 2 repeats, base against candidate): clock ms per birth down at least 80 %; no black and no exit 75 at 1 a second; creates completed reported. — evidence: proof.json. The bars and scoring rule were declared on the issue before any run (comment 6922107940) and scored once, as declared:

    shape seed arm run created (errors) clock ms per create worst level black → exit 75
    uniform 1 base 43906207658 0 (100) null black yes
    uniform 1 candidate 43906214999 100 (0) 239.3 amber no
    uniform 2 base 43906220870 0 (100) null black yes
    uniform 2 candidate 43906226805 100 (0) 207.6 amber no
    event 1 base 43906232622 0 (100) null black yes
    event 1 candidate 43906239033 100 (0) 216.3 amber no
    event 2 base 43906244147 6 (94) null black yes
    event 2 candidate 43906250536 100 (0) 194.6 green no
    • B1, met. Uniform: candidate mean 223.5 ms per create. Event: 205.5 ms. Every base world went black and exited before writing its profile, so the declared 6,000 ms reference applies: −96.3 % and −96.6 %, against a bar of 1,200 ms or less.
    • B2, met. No candidate run went black or exited 75. Every base run did.
    • B3, reported. Every candidate run completed 100 of 100 creates, with 0 errors.
    • Each run had 6 cores of its own, and the machine was 7 to 19 % busy at start. The candidate runs measure cb3880f (the fix at f07c43d). The later fix 2c903b7 changes only whole-ground worlds, not Eden 2026 on paged ground.

Proof

Tier: T3 (node tools/proof/tier.mjs)

  • proof.json: https://assets.eden.art/proofs/pr-2624/proof-2.json

  • clips: Full-resolution video: join-burst-desktop.mp4, 1280×720, 23.8 s, uncut and real speed, timed-run 43906458152. On Eden 2026 with fake minds, twelve new Souls join one a second from 0:02.5 to 0:14.5 and all twelve are admitted. From 0:17 the camera follows Joiner1, standing with the others at the arrival point while the world runs. The clip was recorded on the candidate code plus the clip kit, which lives only on the proof branch agent/2621-clip.

    Reduced preview: join-burst-desktop.mp4

  • images: none

  • playtest: the A3 timed runs above (2 repeats per arm per shape; candidate passed all 4, base none)

  • review: the coordinator's reviewer agent found no blocking defect; its findings B1 (non-paged ground) and B4 (the flag line in the docs) are fixed in 2c903b7

Self-audit

  • Checks run:
    • tsc --noEmit -p packages/engine-mars -> clean
    • tsc --noEmit -p apps/server -> clean
    • the tests listed under A1 -> all pass
    • node tools/test-harness/walk/walk.mjs -> no place worse than the baseline
    • node tools/changelog/compile.mjs --check -> 39 valid fragments
  • Failed attempts: the first head (f07c43d) let the live search run on whole (non-paged) ground, where it moved the navigation epoch. The review caught it, and 2c903b7 keeps the probe there. The A3 candidate runs measure f07c43d; for Eden 2026 on paged ground the code path is the same.
  • Long tail / externalities:
    • Each birth still runs spawnHuman's search twice: once in the guard and once in the apply. That is two walk_to plans per ring spot tried, and it is A8a's proposed follow-up 2.
    • The one-birth-at-a-time pacing in LifecycleRunner is unchanged.
    • Direct (non-lifecycle) creates are unchanged; they never probed.
  • Known limits:
    • A birth during non-resumable native activity is still deferred, as the probe deferred it (birth.checkpoint-required). Keeping that answer is what makes this no rule change. The live placement no longer needs a checkpoint, so dropping the deferral would be a later rule change with its own id.
    • The off/on hash comparison runs over the lifecycle birth tests. The walk gate covers the spawnHuman extraction, which has no switch.
  • Docs: docs/architecture/engine-contract.md gets a Birth placement line documenting SIM_BIRTH_PROBE=1 (rollback) and =oracle. The code comments in lifecycle-runner.ts, arrival-placement.ts, birth.ts and engine.ts are updated.

Changelog

changes/2621-birth-on-live-engine.md (perf)

Risk

  • What could break: a live placement that differed from the probe would put a birth in a different spot, or refuse it differently. It cannot differ from the apply, because the guard runs the apply's own search on the same state just before it, with no engine change in between.
  • How it is tested: the oracle tests compare against the probe on Eden 2026, the commons and green field, plain and crowded. SIM_BIRTH_PROBE=oracle checks it live.
  • Rollback: set SIM_BIRTH_PROBE=1 on the world (the probe decides again), or revert this PR.
  • Why the playtest covers it: the A3 waves run real lifecycle births at 1 a second on a busy Eden 2026, the journey that went black.

Time: about 0.8 h of work against the 4 h ceiling. I started at 16:05 UTC and finished scoring at about 17:45 UTC; that 1.7 h of wall clock includes about 50 min waiting on runners. The work was the fix and the draft from 16:05 to 16:25, the review fixes from 16:30 to 16:40, and the A3 scoring, clip and proof from 17:30 to 17:45.

Outside Touches:

  • packages/engine-mars/src/engine.ts: spawnHuman's search extracted, plus birthPlacementV1. The design names it ("move spawnHuman's placement into a read-only birthPlacementV1 on the live engine").
  • apps/server/src/arrival-placement.ts: the runner's preview (planNativeBirth) lives there.
  • apps/server/src/birth-placement-eden.test.ts: a new test for the birth path.
  • docs/architecture/engine-contract.md: one line documenting the flag (the coordinator asked for it).

🤖 Generated with Claude Code

…d checkpoint (Scaling A13)

The lifecycle guard in drainInputs and the runner's preview ran probeNativeHumanBirth, a full
snapshot and restore of the world, two or three times per birth (about 6-7 s of clock per birth
on Eden 2026 with 50 acting). They now run MarsEngine.birthPlacementV1: spawnHuman's own placement
search on the live engine, changing nothing, with the probe's verdict (humanBirthIssue) at the spot.
The probe stays as the oracle: SIM_BIRTH_PROBE=1 decides by it, =oracle checks every placement
against it. Same outcome, same reasons: no rule change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@genekogan genekogan added the ci:run Open the CI window: run this ready PR's heavy CI jobs (docs/testing.md#ci-window) label Nov 16, 2026
…e navigation is unmoved (#2624 review)

On whole ground the live search grew the ground window to the trial body and moved spatial.epoch,
so a later far walk could be refused live and admitted on replay. nativeBirthPlacement now uses the
probe there (livePlacementExact: no ground, or paged ground); placeNativeHumanBirth refuses it. The
oracle tests also assert the epoch and window are unchanged by the live placement. engine-contract.md
documents SIM_BIRTH_PROBE=1 (rollback) and =oracle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@genekogan
genekogan marked this pull request as ready for review November 16, 2026 17:40
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Proof check: proof-ok passes

Tier T3 from apps/server/src/lifecycle-runner.test.ts, apps/server/src/lifecycle-runner.ts, packages/engine-mars/src/birth.test.ts, packages/engine-mars/src/birth.ts, ... (node tools/proof/tier.mjs).
Required at T3 (docs/process/PROOF-POLICY.yml): T2; scenario playtest with repeats_per_arm repeats per arm; reviewer agent pass; maintainer sign-off.

Check Status Detail
maintainer sign-off ok approved:maintainer added by @genekogan
problem statement ok present
linked issue ok #2621
acceptance ok 3/3 met
carried from the issue ok all 3 issue criteria present
self-audit ok checks, failed attempts, long tail and limits filled
clip ok 1 video link(s), 1 image(s)
proof.json ok valid and agrees with the checklist
playtest ok baseline: 0/4, candidate: 4/4
reviewer pass ok coordinator reviewer agent: no blocking defect; non-paged ground write (B1) fixed in 2c903b7, flag documented (B4)
Acceptance criteria
Criterion Status Evidence
[x] A1 An oracle test across many births in Eden 2026 (and a crowded variant) met proof.json and these results:
[x] A2 No full-world snapshot or restore on the birth path; the probe runs on met on a world with no ground or paged ground (Eden 2026 and every default ground world: NAV_PAGED defaults on), the guard
[x] A3 Bars declared before the runs (settled --wave, 100 creates at 1 a se met proof.json. The bars and scoring rule were declared on the issue

Proof links: 1 video, 1 image, proof.json linked.

Full-resolution videos — use the original clips and their proof metadata for motion/contact review. GIFs below are reduced previews.

join-burst-desktop.mp4

Updated on every edit, push, label and review. How to fill it: .claude/skills/journal/SKILL.md. T3-T4 also need the maintainer's sign-off (tools/proof/gate.mjs). A maintainer can waive with the proof:waived label.

@genekogan genekogan added ci:run Open the CI window: run this ready PR's heavy CI jobs (docs/testing.md#ci-window) and removed ci:run Open the CI window: run this ready PR's heavy CI jobs (docs/testing.md#ci-window) labels Nov 16, 2026
@genekogan

Copy link
Copy Markdown
Member Author

Coordinator sign-off (T3).

  • Review: an independent reviewer found no correctness defect. Placement is read-only on paged ground, with no RNG and a matching state hash. The extraction is byte-identical. The non-paged ground write (B1) now falls back to the probe, with an epoch and window assertion; the docs line is added.
  • A3 met: at 100 joins a second with 50 acting, base created 0–6 of 100 and went black then exit 75 in all 4 runs. The candidate created 100 of 100 with 0 errors, never black, at about 205–224 ms of clock per create (−96 %).
  • Release: this is included in the 0.130 re-cut with A14 (PR 2623). Both close the world-restart-under-load path, and the full gate and V7 re-run on that head.

@genekogan genekogan added approved:maintainer Maintainer sign-off on a T3+ PR they authored (GitHub forbids self-approval) merge:ready Hand the PR to the merge train (.github/workflows/merge-train.yml) labels Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved:maintainer Maintainer sign-off on a T3+ PR they authored (GitHub forbids self-approval) ci:run Open the CI window: run this ready PR's heavy CI jobs (docs/testing.md#ci-window) merge:ready Hand the PR to the merge train (.github/workflows/merge-train.yml)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scaling A13 · A Soul's birth costs a busy world 6–7 s of clock (full-world probe); place births on the live engine instead

1 participant